package com.ibeeking.found.upms.cp.rest.service.impl;

import com.ibeeking.found.common.constants.RoleConstant;
import com.ibeeking.found.upms.cp.rest.service.ICpRoleService;
import com.ibeeking.found.upms.service.common.dos.CpRoleDO;
import com.ibeeking.found.upms.service.mapper.CpRoleMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @ClassName CpRoleServiceImpl
 * @Description
 * @Author ibeeking
 * @Date 2021-05-13 11:42
 **/
@Service
public class CpRoleServiceImpl implements ICpRoleService {

    @Resource
    private CpRoleMapper cpRoleMapper;

    @Override
    public Long selectAdministratorId() {
        CpRoleDO roleDO = cpRoleMapper.selectOne(new LambdaQueryWrapper<>(CpRoleDO.class).eq(CpRoleDO::getCode, RoleConstant.ADMINISTRATOR));
        return roleDO.getId();
    }
}
